Exemple #1
0
    public void AddAresta(VERT_ID from, VERT_ID to, EDGE_DATA data, conectCondition condition = null)
    {
        if (condition == null)
        {
            condition = ConectConditionDefault;
        }
        if (condition?.Invoke(vertices[from], vertices[to]) == false)
        {
            return;
        }

        double w = (calcWeightFnc != null) ? calcWeightFnc(data):0;

        Edge e = new Edge
        {
            connectedTo = vertices[to],
            data        = data,
            weight      = w
        };

        vertices[from].connections.Add(e);

        if (!digraph)
        {
            Edge e2 = new Edge
            {
                connectedTo = vertices[from],
                data        = data,
                weight      = w
            };
            vertices[to].connections.Add(e2);
        }
    }
Exemple #2
0
    public void AddAresta(VERT_ID from, VERT_ID to, double Weight = 1, conectCondition condition = null)
    {
        if (condition == null)
        {
            condition = ConectConditionDefault;
        }
        if (condition?.Invoke(vertices[from], vertices[to]) == false)
        {
            return;
        }

        double w = Weight;

        Edge e = new Edge
        {
            connectedTo = vertices[to],
            data        = default,