Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package graphen;
- import java.util.LinkedList;
- public class AdjacencyList extends AdjacencyStructure {
- public LinkedList<LinkedList<Pair>> list;
- public int length;
- public int edges;
- public AdjacencyList(LinkedList<Edge> edges, LinkedList<Vertice> vertices) {
- int i = 0;
- for (Vertice v : vertices) {
- ++i;
- LinkedList<Pair> tempedges = new LinkedList<Pair>();
- for (Edge e : edges) {
- if (e.start==i) {
- tempedges.add(e.toPair());
- }
- }
- System.out.println("shit");
- if(tempedges == null)
- System.out.println("shitz doesnt come here");
- list.add(tempedges);
- }
- }
- @Override
- public void print() {
- System.out.print("AdjacencyList:\n");
- int i = 1;
- for(LinkedList<Pair> lp : list) {
- System.out.print(1+" -> ");
- for (Pair p : lp) {
- System.out.print(p.toString());
- }
- System.out.println("\n");
- i++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement