consecutive node sequence and pathlength problem using networkx graph

B

bob

Let say,I have a conjugated cyclic polygon and its nodes are given
by the list:
list_p=[a,b,c,d,e,f,g,a,a,b,d,d,d,d,d,c,c,e,e,a,d,d,g]. If X & Y
are any elements in
a list_p except d, and Z is also an element of list_p but has
value only d, i.e,
Z=d. Now,I want to compute the number of paths with sequence X-Z-
Y consecutive nodes,
example: a-d-d-e,a-d-d-a, a-d-d-d-g, etc. Consecutive path length
of Z can be 1,2,3,4 or 5.

To generalize: Find total number of paths with consecutive X-Z-Y
sequence for path length of
z within range(1,6): or
(i) X-Z-Y for len(Z)=1
(ii) X-Z-Y for len(Z)=2
(iii)X-Z-Y for len(Z)=3
(iv) X-Z-Y for len(Z)=4
(v) X-Z-Y for len(Z)=5

Is there any easy way to program this using python networkx or
igraph?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top