forked from techpanja/interviewproblems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraph.java
More file actions
58 lines (43 loc) · 1.08 KB
/
Graph.java
File metadata and controls
58 lines (43 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package graphs.graph;
import java.util.List;
/**
* Graph Interface.
* User: rpanjrath
* Date: 10/24/13
* Time: 6:04 PM
*/
public interface Graph {
/*
* Returns current number of vertices in the graph.
* */
int getCurrentSize();
/*
* Returns the vertex array.
* */
Vertex[] getVertexesAsArray();
/*Returns a cloned copy.*/
List<Vertex> getVertexesAsList();
void displayVertexList();
Vertex getFirstVertex();
/*
* Adds a vertex to the graph.
* */
boolean addVertex(Vertex vertex);
/*
* Directed/UnDirected edge from fromVertex to toVertex.
* */
boolean addEdge(Vertex fromVertex, Vertex toVertex);
boolean addEdge(String fromVertex, String toVertex);
int getMaxSize();
void displayGraphDependency();
boolean isVertexExisting(Vertex vertex);
Vertex getVertex(String vertexLabel);
/*
* Sorts the entire graph
* */
List<Vertex> topoSortGraph();
/*
* Sorts only a part of graph starting with the input vertex.
* */
List<Vertex> topoSortGraph(Vertex vertex);
}