Skip to content
START WITH A QUESTION

What would you like to understand?

Find an answer. See the moment it becomes clear. Follow the idea further.

← Concept directory

Answers for “如何在图上启动 Prim 算法?”

2 keyword matches

Understanding your question. You can explore the search results below now.

Find a method

↗

To start Prim's algorithm, create an empty list called 'visited' to track touched nodes, then pick an arbitrary starting node and add it to the visited list.

Conditions: The graph is weighted and connected.; You have a mechanism to track visited vertices (e.g., a list or set).

Meet the concept

↗

A minimum spanning tree (MST) is a connected, acyclic subgraph that spans all vertices of a weighted graph and has the minimum possible total edge weight.

Conditions: The underlying graph must be weighted.; The graph must be connected for a spanning tree to exist.; The MST minimizes the sum of selected edge weights.; The MST contains no cycles.