More flexibility is fairly straight forward too, especially if
you combine one of these routines with adding a one or two edges
yourself. Adding a bidirectional edge requires that you add
both directions--but no more difficulty than that.
The package might have exactly what your looking for, but even
if it doesn't it is very likely that you can supplement with
a very simple function that calls package functions and gets done
exactly what you want.
a-b-c and c-d-e to a-b-c-c-d-e:
H=nx.union(G1,G2,rename=('1-','2-'))
elist=[ ('1-'+str(n1),'2-'+str(n1)) for n1 in G1 if n1 in G2]
H.add_edges_from(elist)
a-b-c and c-d-e to a-b-c-d-e:
H=nx.union(G1,G2,rename=('1-','2-'))
nodes_in_both=[n for n in G1 if n in G2]
for n in nodes_in_both:
n1='1-'+str(n)
n2='2-'+str(n)
H.add_edges_from([ (n1,nbr) for nbr in H[n2] ])
H.remove_node(n2)
(These aren't tested, but hopefully show some ideas.)
Dan
> --
> You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
> To post to this group, send email to networkx...@googlegroups.com.
> To unsubscribe from this group, send email to networkx-discu...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/networkx-discuss?hl=en.
>
Create two Erdos-Reni graphs (random graphs) “G” and “H” (different numbers of nodes & probability & color) which will be connected with some links. Then randomly draw a node from “G” and remove it with all edges connected to it. If this node is also connected with other nodes from “H”, remove them with all edges as well….......If "H" node is not connected with “G” nodes STOP
All the best,
Martin