public void AddEdge(int node1, int node2, int weight, TypesOfGraph typeOfGraph)
        {
            //Node1 -> Node2
            _adjacentList[node1].AddChildren(node2, weight);

            //Node2 -> Node1
            if (typeOfGraph == TypesOfGraph.Undirected)
            {
                _adjacentList[node2].AddChildren(node1, weight);
            }
        }
Example #2
0
        public void AddEdge(int node1, int node2, TypesOfGraph typeOfGraph)
        {
            //Node1 -> Node2
            addItem(node1, node2);

            //Node2 -> Node1
            if (typeOfGraph == TypesOfGraph.Undirected)
            {
                addItem(node2, node1);
            }
        }