r - how to find path of a cycle from an adjacency list -
i have directed subgraph nodes in cycle (with 21 nodes , ~250 edges) , want know order of how nodes form cycle.
i'm not familiar graph algorithm. thought using igraph::graph.dfs function original or reverse graph. , use order or order.out returned order, didn't work.
the subgraph connected components found igraph::clusters
i've asked similar question graph.get.subisomorphisms.vf2 takes long run in case.
i'm thinking if can ordered adjacency list this, may able find cycle starting longest list

but can unordered list using igraph::get.adjlist, i'd know if there's way ordered list below.
and suggestions find node order of cycle?
thanks in advance!
data
> dput(adjlist) structure(list(`26` = c(2, 3, 4, 5, 6, 7, 8, 10, 11, 15, 16, 18, 19), `2` = c(1, 3, 4, 5, 6, 7, 8, 10, 15, 16, 18), `30` = c(1, 2, 4, 5, 6, 7, 8, 10, 11, 14, 15, 16, 17, 18, 19, 21), `25` = c(1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 15, 16, 18, 21), `29` = c(1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 15, 16, 18, 21), `9` = c(1, 2, 3, 4, 5, 7, 8, 10, 14, 15, 16, 18, 19), `27` = c(1, 2, 3, 4, 5, 6, 8, 14, 15, 18), `13` = c(3, 4, 5, 15), `14` = c(1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 14, 15, 16, 18, 19, 21), `8` = c(1, 2, 3, 4, 5, 6, 7, 8, 14, 15, 16, 18), `23` = c(1, 2, 3, 4, 5, 6, 7, 8, 10, 14, 15, 16, 17, 18, 19), `20` = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21), `19` = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 21), `17` = c(1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 15, 16, 17, 18, 21), `12` = c(3, 4, 5, 6, 8), `24` = c(4, 6, 7, 8, 9, 10, 11, 15), `21` = c(13, 14), `6` = c(2, 3, 4, 5, 6, 8, 10, 15), `28` = c(1, 7, 11, 16), `15` = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 21), `11` = c(3, 4, 5, 6, 8, 15)), .names = c("26", "2", "30", "25", "29", "9", "27", "13", "14", "8", "23", "20", "19", "17", "12", "24", "21", "6", "28", "15", "11"))
just make sure problem correctly understood: have subgraph of directed graph induced vertices of connected component. have cycle containing vertices of component. 2 possible versions (see the introductory paragraphs here clarification on confusing terminology has developed in respect):
a) each vertex allowed appear once on cycle, i.e. want simple cycle each vertex incident 2 edges of cycle. finding such cycle hamiltonian cycle problem, staple of complexity theory np-hard; no human known have efficient algorithm that.
b) vertices allowed adjacent more 2 edges of cycle, i.e. want closed walk through component. can identifying cycles connect component (you should able extract enough algorithm identifies connected components), , build eulerian cycle of union of cycles found, ignoring other edges in component. possible efficiently, , should straightforward implement.
Comments
Post a Comment