Horje
creating weighted graph in c# Code Example
creating weighted graph in c#
public class Node
{
    public string Name;
    public List<Arc> Arcs = new List<Arc>();

    public Node(string name)
    {
        Name = name;
    }

    /// <summary>
    /// Create a new arc, connecting this Node to the Nod passed in the parameter
    /// Also, it creates the inversed node in the passed node
    /// </summary>
    public Node AddArc(Node child, int w)
    {
        Arcs.Add(new Arc
        {
            Parent = this,
            Child = child,
            Weigth = w
        });

        if (!child.Arcs.Exists(a => a.Parent == child && a.Child == this))
        {
            child.AddArc(this, w);
        }

        return this;
    }
}
creating weighted graph in c#
public class Arc
{
    public int Weigth;
    public Node Parent;
    public Node Child;
}




Csharp

Related
get patht bim 360 revit api Code Example get patht bim 360 revit api Code Example
writeline in c# Code Example writeline in c# Code Example
convert object to httpcontent c# Code Example convert object to httpcontent c# Code Example
mvc remote validation additional table Code Example mvc remote validation additional table Code Example
c# draw rectangle on screen Code Example c# draw rectangle on screen Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11