Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to determine whether a graph has l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient.

  • subgraph_search_iterator-gives-duplicate-subgraphs

    G=graphs.OctahedralGraph() H = graphs.CycleGraph(3) L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) } print(len(L))

    For example, when determining if a graph has a unique k-cycle (when k=1), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient.

  • subgraph_search_iterator-gives-duplicate-subgraphs

    G=graphs.OctahedralGraph() H = graphs.CycleGraph(3) print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) ) L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) } print(len(L))

    For example, when determining if a graph has a unique k-cycle (when k=1), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient.

  • subgraph_search_iterator-gives-duplicate-subgraphs

    G=graphs.OctahedralGraph() H = graphs.CycleGraph(3) print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) ) L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) } print(len(L))

For example, when determining if a graph has a unique k-cycle (when k=1), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient.

  • subgraph_search_iterator-gives-duplicate-subgraphs

    G=graphs.OctahedralGraph() H = graphs.CycleGraph(3) print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) ) L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) } print(len(L))

For example, when determining In an import case for me, determinie if a graph has a unique k-cycle (when k=1), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient.

  • subgraph_search_iterator-gives-duplicate-subgraphs

    G=graphs.OctahedralGraph() H = graphs.CycleGraph(3) print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) ) L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) } print(len(L))

In an import case for me, determinie if a graph has a unique k-cycle $k$-cycle (when k=1), $k=1$), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient.

  • subgraph_search_iterator-gives-duplicate-subgraphs

    G=graphs.OctahedralGraph() H = graphs.CycleGraph(3) print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) ) L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) } print(len(L))

In an import case for me, determinie if a graph has a unique $k$-cycle (when $k=1$), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient.

  • efficient. - subgraph_search_iterator-gives-duplicate-subgraphs

    G=graphs.OctahedralGraph()
    H = graphs.CycleGraph(3)
    print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) )
    L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) }
    print(len(L))

print(len(L))

In an import case for me, determinie if a graph has a unique $k$-cycle (when $k=1$), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient. - subgraph_search_iterator-gives-duplicate-subgraphs

G=graphs.OctahedralGraph()
H = graphs.CycleGraph(3)
print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) )
L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) }
print(len(L))

In an import case for me, determinie if a graph has a unique $k$-cycle (when $k=1$), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has at most l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains at most l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient. - subgraph_search_iterator-gives-duplicate-subgraphs

G=graphs.OctahedralGraph()
H = graphs.CycleGraph(3)
print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) )
L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) }
print(len(L))

In an import case for me, determinie if a graph has a unique $k$-cycle (when $k=1$), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has at most l cycles of length k

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains at most l k-cycles. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient. - subgraph_search_iterator-gives-duplicate-subgraphs

G=graphs.OctahedralGraph()
H = graphs.CycleGraph(3)
print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) )
L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) }
print(len(L))

In an import case for me, determinie if a graph has a unique $k$-cycle (when $k=1$), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs

How to determine whether a graph has at most l cycles of length kk exactly?

Given integers$ l\ge 0$, $k\ge 3$, and a graph, I want to know if it contains at most l k-cycles. $l$ $k$-cycles exactly. I could enumerate all cycles of length k using the link below and count them, but this might not be very efficient. - subgraph_search_iterator-gives-duplicate-subgraphs

G=graphs.OctahedralGraph()
H = graphs.CycleGraph(3)
print( sum(1 for _ in G.subgraph_search_iterator(H, induced=False,return_graphs=False) ) )
L = { tuple(g.edges(labels=False,sort_vertices=True,sort=True)) for g in G.subgraph_search_iterator(H, induced=False) }
print(len(L))

In an import case for me, determinie if a graph has a unique $k$-cycle (when $k=1$), I don't need to list all cycles and then check; instead, obtaining two cycles would suffice, and the algorithm stops.

Similarly, such questions can be asked about subgraphs