本文集用到的自定义数据结构

Edge:

/**
 * Created by wang on 2017/11/27.
 */
public class Edge {
    public Node from;
    public Node to;
    public int weight;

    public Edge(Node to,Node from,int weight){
        this.from = from;
        this.to = to;
        this.weight = weight;
    }
}

Node:

import java.util.ArrayList;

/**
 * Created by wang on 2017/11/27.
 */
public class Node {
    public int value;
    public int in;
    public int out;
    public ArrayList nexts;
    public ArrayList edges;

    public Node(int value){
        this.value = value;
        in = 0;
        out = 0;
        nexts = new ArrayList();
        edges = new ArrayList();
    }
}

Graph:

import java.util.HashMap;
import java.util.HashSet;

/**
 * Created by wang on 2017/11/27.
 */
public class Graph {
    public HashMap nodes;
    public HashSet edges;

    public Graph(){
        nodes = new HashMap<>();
        edges = new HashSet<>();
    }
}

你可能感兴趣的:(本文集用到的自定义数据结构)