Hello,
I am not sure that I understood your message very well. Are you saying
that one way to achieve what you do would be to call the current
"subgraph_search" methods, and to *filter* among its results those
which are actually *equal* (considering edge labels) to the graph you
are looking for?
If so, it works. It is just.. Well, ugly in the backscene. But if you
only deal with very small instances, then the following does what you
like:
g = DiGraph({0: {1: 'a'}, 1: {2: 'b'}})
s = DiGraph({0: {1: 'a'}})
def subgraphs_with_labels(G,H):
r"""
An iterator over all subgraphs of G isomorphic to H (edge labels are taken
into account)
"""
G = G.copy()
H = H.copy()
G.weighted(True)
H.weighted(True)
Hverts = H.vertices()
for g in G.subgraph_search_iterator(H):
gg = G.subgraph(vertices=g)
gg_rel = gg.relabel(dict(zip(g,Hverts)),inplace=False)
if H == gg_rel:
yield gg
sage: list(subgraphs_with_labels(g,s))
[Subgraph of (): Digraph on 2 vertices]
Nathann
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.