internal nNode FindNode(int id) { int i = _nodes.IndexOfKey(id); if (i >= 0) { return(_nodes.Values[i]); } VfException.Error("Inconsistent data"); return(null); }
internal Vertex <TV, TE> FindVertex(int id) { var i = VertexList.IndexOfKey(id); if (i >= 0) { return(VertexList.Values[i]); } VfException.Error("Inconsistent data"); return(null); }
public eNode FindOutEdge(int nidTo) { try { return(_edgesFrom[nidTo]); } catch (Exception) { VfException.Error("Inconsistent Data"); } return(null); }
public Edge <TE, TV> FindOutEdge(int vidTo) { try { return(EdgesFromList.FirstOrDefault(e => e.To.ID == vidTo)); } catch (Exception) { VfException.Error("Inconsistent Data"); } return(null); }
public void DeleteEdge(int vidFrom, int vidTo) { var vtxFrom = FindVertex(vidFrom); var vtxTo = FindVertex(vidTo); var end = vtxFrom.EdgesFromList.FirstOrDefault(e => ReferenceEquals(vtxTo, e.To)); if (end == null) { VfException.Error("Inconsistent Data"); } vtxFrom.EdgesFrom.Remove(vidTo); vtxTo.EdgesTo.Remove(end); vtxFrom.EdgesFromList.Remove(end); }
public int GetOutEdge(int idFrom, int pos, out object attr) { eNode end = null; try { end = FindNode(idFrom)._edgesFrom.Values[pos]; } catch (Exception) { VfException.Error("Inconsistent data"); } attr = end._attr; return(end._idTo); }
public int GetOutEdge(int idFrom, int pos, out TE attr) { Edge <TE, TV> end = null; try { end = FindVertex(idFrom).EdgesFrom.Values[pos]; } catch (Exception) { VfException.Error("Inconsistent data"); } // ReSharper disable once PossibleNullReferenceException attr = end.Attr; return(end.IDTo); }
public void AddEdge(int vidFrom, int vidTo, TE attr = default(TE)) { var end = new Edge <TE, TV>(vidFrom, vidTo, this); var vtxFrom = FindVertex(vidFrom); var vtxTo = FindVertex(vidTo); end.Attr = attr; try { vtxFrom.EdgesFrom.Add(vidTo, end); vtxFrom.EdgesFromList.Add(end); vtxTo.EdgesTo.Add(end); } catch (Exception) { VfException.Error("Inconsistent Data"); } }
public void InsertEdge(int nidFrom, int nidTo, object attr) { eNode end = new eNode(); nNode nodFrom = FindNode(nidFrom); nNode nodTo = FindNode(nidTo); end._idFrom = nidFrom; end._idTo = nidTo; end._attr = attr; try { nodFrom._edgesFrom.Add(nidTo, end); nodTo._edgesTo.Add(end); } catch (Exception) { VfException.Error("Inconsistent Data"); } }