fr.umlv.gramofone.graphs
Class GraphSearchs
java.lang.Object
fr.umlv.gramofone.graphs.GraphSearchs
public class GraphSearchs
- extends java.lang.Object
Some class searchs (bfs, dfs) on graphs
|
Method Summary |
java.util.Set<Edge> |
bfs(int n)
|
java.util.HashMap<java.lang.Integer,java.util.HashSet<java.lang.Integer>> |
componentsIte()
Get all connected components of the graph (by iterative depth first search) |
boolean |
isConnected()
Return true if the graph is connected (use a depth first search) |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GraphSearchs
public GraphSearchs(MyGraph g)
isConnected
public boolean isConnected()
- Return true if the graph is connected (use a depth first search)
- Returns:
componentsIte
public java.util.HashMap<java.lang.Integer,java.util.HashSet<java.lang.Integer>> componentsIte()
- Get all connected components of the graph (by iterative depth first search)
- Returns:
- hashmap of component (number of the component -> set of nodes in this component)
bfs
public java.util.Set<Edge> bfs(int n)