src/Shared/EntityFramework/Core/Mapping/Update/Internal/Graph.cs
// <summary>
// Adds a new edge to the graph. NOTE: only adds edges for existing vertices.
// </summary>
// <param name="from"> Source node </param>
// <param name="to"> Target node </param>
Adds a new edge to the graph. NOTE: only adds edges for existing vertices.
Adds a new edge to the graph . NOTE : only adds edges for existing vertices .
internal void AddEdge(TVertex from, TVertex to)
        {
            if (m_vertices.Contains(from)
                && m_vertices.Contains(to))
            {
                HashSet<TVertex> successors;
                if (!m_successorMap.TryGetValue(from, out successors))
                {
                    successors = new HashSet<TVertex>(m_comparer);
                    m_successorMap.Add(from, successors);
                }
                if (successors.Add(to))
                {
                    int predecessorCount;
                    if (!m_predecessorCounts.TryGetValue(to, out predecessorCount))
                    {
                        predecessorCount = 1;
                    }
                    else
                    {
                        ++predecessorCount;
                    }
                    m_predecessorCounts[to] = predecessorCount;
                }
            }
        }
internal void AddEdge ( TVertex from , TVertex to ) { if ( m_vertices . Contains ( from ) && m_vertices . Contains ( to ) ) { HashSet < TVertex > successors ; if ( ! m_successorMap . TryGetValue ( from , out successors ) ) { successors = new HashSet < TVertex > ( m_comparer ) ; m_successorMap . Add ( from , successors ) ; } if ( successors . Add ( to ) ) { int predecessorCount ; if ( ! m_predecessorCounts . TryGetValue ( to , out predecessorCount ) ) { predecessorCount = 1 ; } else { ++ predecessorCount ; } m_predecessorCounts [ to ] = predecessorCount ; } } }
Adds a new edge to the graph.
Adds a new edge to the graph .
// Add only edges relevant to the current graph vertices // If the edge does not already exist, increment the count of incoming edges (predecessors).
from
TVertex
None
to
TVertex
None