Figure finishing

  1. FIG: The predecessor and successor nodes without restriction
  2. FIG: a directed graph, and edge point set V binding to E and FIGS free
  3. Multiple FIG: G appears multiple times in an edge
  4. Of vertices: the degree of penetration, the total degree = number of edges in FIG. 2 *
  5. Path, the path length, simple path (in addition to not have the same starting point and the starting point of focus), a simple loop
  6. Subgraph, spanning subgraph
  7. Communication, strong graph
  8. Communication component (not unique)
  9. Weighted graph
  10. Adjacency matrix storage
  11. Adjacent table storage (array + chain)
  12. Depth-first traversal (similar to preorder traversal of the tree), recursive, n for the complexity of the square
  13. Depth first iterative algorithm: stack, pop-up vertex not visited, unvisited neighbor the stack
  14. Breadth-first traversal (tree-like hierarchy traversal), queue implementation
  15. Topological sorting: AOV network does not ring (critical path: commonly used in software engineering)
  16. The basic idea of ​​topological sorting algorithm: selecting one of the output point 0, deleting the vertex and all edges out, continues until all vertices have or not the output of the point 0 (there is described ring)
  17. Algorithm: an array of the recording sount
  18. Thought stack with an array of analog: top, in charge of topological sorting time O (n + e)
  19. Critical path: the length of the longest path from the source point to sink point
  20. Recurrence formula earliest time of occurrence, the latest time of occurrence recurrence formula
  21. Shortest Path: Dijstrka algorithm with: n square complexity
  22. Floyd algorithm: the shortest path between any two points: n ^ 3

    l definition of a n -order square matrix sequence: A (-1) A (0) , ...,  A ( n-. 1 ) .
    wherein  A (-1) [ I ] [ J ] = Edge [ I ] [ J ] ;
    for any 0 K n- -1 , A ( K ) [ I ] [ J ] = min { A ( K -1) [ I ] [ J ], A(k-1)[i][k] + A(k-1)[k][j] }

  23. l time complexity : the Floyd time complexity of the algorithm is O (n . 3 ) , and the call n times Dijkstra algorithm for finding the shortest path for each pair of vertices same time complexity.

    ² dense graph: Practice shows that Floyd algorithm faster

    ² sparse graph: By using heap, Dijkstra time complexity of the algorithm can be further improved .

    l Applicable problem : Dijkstra algorithm is only right for a positive view, and Floyd algorithm allows the figure sideband negative weights, but does not allow the loop contains negatively weights,

    l readability : Floyd algorithm is more simple and easy to understand.

  24. Minimum Spanning Tree: Spanning Tree: (there is only one path connected undirected graph vertices between any) supporting the sub-tree of FIG. + Free, minimum weight
  25. Prim's algorithm:

    l basic steps :
    Set N = (V, E, C ) communication network, the TE is N set of edges of the Minimum Spanning Tree.
    beginning of the algorithm, the U-U = { 0 } ( U 0 ∈ V ), the TE = null ;
    satisfying a weight equal to

    min{weight(u‘’, v‘’) | u‘’∈U, v‘’∈V-U},

    Sides (U, v) , which was added to TE , and the v join the U- .
    repeated ② , up = V U terminated algorithm.

  26. l storing method Minimum Spanning Tree : auxiliary array the TE [ n- - . 1] to save the set of edges of a minimum spanning tree, each array element of the TE [ I ] indicates that an edge, the TE [ I ] consists of three domain head , tail and cost structure, which are stored the starting point side, and the right end value.  
  27. Time Complexity: N ^ 2
  28. Kruskal ( Kruskar ) algorithm
  29. Provided communication network N = (V, E, C) , T is N the minimum spanning tree. Initial T = {V, { Æ to }} , i.e. T no edge, only n vertices is n a connected component.

    from E to select the smallest weight edge, and this edge from E deletion.

    If two vertices of this edge at T different connected components, then this was added to the edge of T , resulting in T reducing a communication component; otherwise, two vertices of this edge in the same connected component in , does nothing.

    is repeated ①②, until T when a remaining connected component, terminate the operation.

  30. (E log e) = O (log n and)
  31. l Prim time complexity of the algorithm is O ( n- 2 ) , Minimum Spanning Tree algorithm is applied to find the edge of a dense network.

    l Kruskal algorithm contrary, it applies to Minimum Spanning Tree request sparse network side, because of its time complexity is O ( E log n- ) .

  32. ​​​​​​​
Published 32 original articles · won praise 5 · Views 4657

Guess you like

Origin blog.csdn.net/qq_38941327/article/details/90647848