Beispiel #1
0
        public void AddEdge(T data1, T data2)
        {
            WeightedEdge <T> edge = new WeightedEdge <T>();

            AddEdge(FindNode(data1), FindNode(data2));
            edge.RegisterProperties(FindNode(data1), FindNode(data2), 0.0f);
            m_edges.Add(edge);
        }
Beispiel #2
0
        public void AddEdge(T homeData, T neighborData, float weight)
        {
            Node <T>         home     = FindNode(homeData);
            Node <T>         neighbor = FindNode(neighborData);
            WeightedEdge <T> edge     = new WeightedEdge <T>();

            AddEdge(home, neighbor);
            home.AddEdge(edge);
            neighbor.AddEdge(edge);
            edge.RegisterProperties(home, neighbor, weight);
            edges.Add(edge);
        }
Beispiel #3
0
        public void AddEdge(Node <T> home, Node <T> neighbor, float weight)
        {
            WeightedEdge <T> edge = new WeightedEdge <T>();

            if (home == null || neighbor == null)
            {
                return;
            }

            home.neighbors.Add(neighbor);
            neighbor.neighbors.Add(home);

            home.AddEdge(edge);
            neighbor.AddEdge(edge);
            edge.RegisterProperties(home, neighbor, weight);
            m_edges.Add(edge);
        }
Beispiel #4
0
 public void AddEdge(WeightedEdge <T> edge)
 {
     m_edges.Add(edge);
 }