Ask Your Question

Revision history [back]

First of all, you do not need numpy to initialize a graph. Simply write

M1 = DiGraph(matrix([[0,1,0],[0,0,1],[0,0,0]])) #first motif
M5 = DiGraph(matrix([[0,1,1],[0,0,1],[0,0,0]])) #second motif

Your question is documented in subgraph_search, subgraph_search_iterator and subgraph_search_count. You can access the documentation through

sage: G = DiGraph()
sage: G.subgraph_search?

There is an option induced which allows you to search only for induced subgraph and which is False by default.

sage: M5.subgraph_search_count(M1)
sage: M5.subgraph_search_count(M1,induced=True)