Here is my table "graphtable" having graph nodes. Each tuple represents an undirected edge.
╔═════════╦═════════╗
║ NODEONE ║ NODETWO ║
╠═════════╬═════════╣
║ A ║ A ║
║ A ║ A ║
║ A ║ B ║
║ A ║ B ║
║ A ║ A ║
║ C ║ D ║
║ C ║ A ║
║ D ║ E ║
║ A ║ E ║
║ D ║ A ║
║ G ║ K ║
║ G ║ G ║
║ K ║ K ║
║ K ║ L ║
║ L ║ M ║
║ Y ║ M ║
║ G ║ L ║
║ G ║ L ║
║ X ║ Z ║
║ D ║ D ║
║ I ║ I ║
╚═════════╩═════════╝
As you can see, there are four distinct undirected graphs in this table.
- nodes(A,B,C,D,E)
- nodes(L,K,G,M,Y)
- nodes(I)
- nodes(X,Z)
I tried queries similar to one posted below;
select nodeone,nodetwo
from
graphtable
start with NODEONE='D'
connect by nocycle prior nodeone=nodetwo
I can use recursive query also to traverse through the graphs.
But, I need to get all the tuples involved in the particular graph if I start with any of the nodes in that particular graph. However, I am not getting that result from any of my queries.
start with nodeone='A'; seemed to return all the edges, but edge 'D-D' wasnt present. start with nodeone='D'; doesnt seem to return anything near to previous result.
Please help.. I appreciate any help in advance. Thank you.