Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I search and count all induced subgraphs in a directed graph with edge labels?

Hello all,

I can extract all induced subgraphs and count them in a graph. My question is how I can search and count all induced subgraphs in a labeled graph (a graph with edge labels)? In documentation of g.subgraph() and g.subgraph_search_count() is mentioned that these functions should work on labeled graphs as well. but it does not work. Here is an example:

sage: g=DiGraph() sage: g.add_vertex(0) sage: g.add_vertex(1) sage: g.add_vertex(2) sage: g.add_edge(0,1,label="a") sage: g.add_edge(1,2,label="b") sage: g.plot(color_by_label="true") sage: g.plot(color_by_label=true)

sage: s=DiGraph() sage: s.add_vertex(0) sage: s.add_vertex(1) sage: s.add_edge(0,1,label="a") sage: s.plot(color_by_label=true)

sage: g.subgraph_search_count(s) 2

While it should return 1 not 2.

How can I search and count all induced subgraphs in a directed graph with edge labels?

Hello all,

I can extract all induced subgraphs and count them in a graph. My question is how I can search and count all induced subgraphs in a labeled graph (a graph with edge labels)? In documentation of g.subgraph() and g.subgraph_search_count() is mentioned that these functions should work on labeled graphs as well. but it does not work. Here is an example:

sage: g=DiGraph() g=DiGraph() sage: g.add_vertex(0) g.add_vertex(0) sage: g.add_vertex(1) g.add_vertex(1) sage: g.add_vertex(2) g.add_vertex(2) sage: g.add_edge(0,1,label="a") g.add_edge(0,1,label="a") sage: g.add_edge(1,2,label="b") g.add_edge(1,2,label="b") sage: g.plot(color_by_label="true") g.plot(color_by_label="true") sage: g.plot(color_by_label=true)g.plot(color_by_label=true)

sage: s=DiGraph() s=DiGraph() sage: s.add_vertex(0) s.add_vertex(0) sage: s.add_vertex(1) s.add_vertex(1) sage: s.add_edge(0,1,label="a") s.add_edge(0,1,label="a") sage: s.plot(color_by_label=true)

sage: g.subgraph_search_count(s) 2

While it should return 1 not 2.

How can I search and count all induced subgraphs in a directed graph with edge labels?

Hello all,

I can extract all induced subgraphs and count them in a graph. My question is how I can search and count all induced subgraphs in a labeled graph (a graph with edge labels)? In documentation of g.subgraph() and g.subgraph_search_count() is mentioned that these functions should work on labeled graphs as well. but it does not work. Here is an example:

sage: g=DiGraph()

sage: g=DiGraph() sage: g.add_vertex(0) sage: g.add_vertex(1) sage: g.add_vertex(2) sage: g.add_edge(0,1,label="a") sage: g.add_edge(1,2,label="b") sage: g.plot(color_by_label="true") sage: g.plot(color_by_label=true)

sage: s=DiGraph() sage: s.add_vertex(0) sage: s.add_vertex(1) sage: s.add_edge(0,1,label="a") sage: s.plot(color_by_label=true)

sage: g.subgraph_search_count(s) 2

While it should return 1 not 2.

How can I search and count all induced subgraphs in a directed graph with edge labels?

Hello all,

I can extract all induced subgraphs and count them in a graph. My question is how I can search and count all induced subgraphs in a labeled graph (a graph with edge labels)? In documentation of g.subgraph() and g.subgraph_search_count() is mentioned that these functions should work on labeled graphs as well. but it does not work. Here is an example:

sage: g=DiGraph()
g=DiGraph()

sage: g.add_vertex(0) sage: g.add_vertex(1) sage: g.add_vertex(2) sage: g.add_edge(0,1,label="a") sage: g.add_edge(1,2,label="b") sage: g.plot(color_by_label="true") sage: g.plot(color_by_label=true)

sage: s=DiGraph() sage: s.add_vertex(0) sage: s.add_vertex(1) sage: s.add_edge(0,1,label="a") sage: s.plot(color_by_label=true)

s.plot(color_by_label=true)

sage: g.subgraph_search_count(s) 2

2

While it should return 1 not 2.