How can i write the code about undirected graph?



  • i have an problem with a question.there is an undirected graph and below is a sample file:
    3 7
    5 24
    12 45
    ...
    Each line above specifies an edge. I want to convert this to adjacency-list in C++.And here are my questions:
    Sparsity of the graph
    Degree of a vertex
    Max, min, and avg. degrees.
    Shortest path between two vertices
    Shortest path passing through a particular vertex
    Average shortest path length.
    Diameter of the graph.

    I just want to understand how can i start to write these codes.I need the codes,but even if you cannot write all ,just give the ideas about how to implement them.Thank you:))))


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.