Sunday 15 May 2011

algorithm - Worst case memory for Graph data structure -


I can see in many books that the worst case memory is required for graphs (V) but, if I get wrong If not, the graphs are usually shown in the form of proximity metrics, rather than the construction of nodes (according to the linked list / tree). Therefore, for the graph containing 5 senes, I want 5x5 matrix, which is O (V ^ 2). Why do they call it O (V)?

Am I forgetting somewhere? Sorry if the question is too naive.

There are three main ways to represent a graph:

  • Stability list - Î ?? (| V | + | E |) Space
  • Collecting node objects / strings with one another with pointers - this is basically another way of representing an adjacent list. Î ?? (| V | + | E |) (Remember that pointers also require memory.)

    Since we are talking in the worst case, all of them at least Î ?? (| V | A²) because it has the maximum number of edges a graph.

    I think you can read the book incorrectly. They probably were not talking about the space required to store the graph structure, but the volume of space additional required for some graph algorithms

  • No comments:

    Post a Comment