c++ - BFS On a Bipartite graph; Shortest Path between two points -
here's assumption i'm making, before started, tell me if wrong:
- representing bipartite graph (shown below): can nxm matrix n 1 side , m other , there's 1 @ index if connected, correct?
anyways, i'm trying represent "erdos" number kind of thing, or "kevin bacon number" kind of thing, 1 side movies , other side actors. far have 2 vectors hold each movie , actor , adjacency matrix matrix of nodes (each nodes contains movie name, actor name, , adjacency boolean/number), 1 if actor in movie , 0 otherwise:
i want figure out how many degrees of separation there between 2 actors (i.e. if actor in movie 1, actor b in movie 1 , 2, , actor c in movie 2, degrees between , c 2; 0 if same actor).
my questions are, doing right far? how continue? know bfs uses queue can't seem right, or start on right path. compare? it's know can't seem think of @ all. have 2 functions give me index of requested actor in actors vector (and 1 movie), give me row , column indices of adjacency matrix vector, in order see node @ index.