public Edge addUndirectionalEdge(Edge e) { Vertex origin = e.getOrigin(); Vertex destination = e.getDestination(); origin.addOutEdge(e); destination.addOutEdge(e); origin.addInEdge(e); destination.addInEdge(e); //Add, if missing vertices if (!vertices.ContainsKey(origin.getId())) { vertices.Add(origin.getId(), origin); } if (!vertices.ContainsKey(destination.getId())) { vertices.Add(destination.getId(), destination); } if (!edges.Contains(e)) { edges.Add(e); } return(e); }
public bool addVertex(Vertex v) { if (vertices.ContainsKey(v.getId())) { return(false); } //Add vertex to <vertexId, vertex> structure vertices.Add(v.getId(), v); //Add vertex to <floorNum, List<Vertex> structure if (v.getLocation() != null && v.getLocation().getAbsoluteLocation() != null) { int floor = (int)v.getLocation().getAbsoluteLocation().getAltitude(); if (!verticesByFloor.ContainsKey(floor)) { verticesByFloor.Add(floor, new List <Vertex>()); } verticesByFloor[floor].Add(v); } return(true); }
// Copy constructor public Vertex(Vertex aVertex) { double latitude = aVertex.getLocation().getAbsoluteLocation().getLatitude(); double longitude = aVertex.getLocation().getAbsoluteLocation().getLongitude(); double altitude = aVertex.getLocation().getAbsoluteLocation().getAltitude(); AggregateLocation aggLoc = new AggregateLocation(new AbsoluteLocation(latitude, longitude, altitude)); this.location = aggLoc; this.inEdges = aVertex.getInEdges(); this.outEdges = aVertex.getOutEdges(); this.id = aVertex.getId(); this.fingerprints = aVertex.getFingerPrints(); this.radiusVertices = aVertex.getRadiusVertices(); }
public bool removeVertex(Vertex v) { foreach (Edge e in v.incidentEdges()) { edges.Remove(e); } //remove from <vertexId, vertex> structure vertices.Remove(v.getId()); //remove from <floorNum, List<Vertex> structure bool hasLocation = v.getLocation() != null && v.getLocation().getAbsoluteLocation() != null; if (hasLocation) { int floor = (int)v.getLocation().getAbsoluteLocation().getAltitude(); if (verticesByFloor.ContainsKey(floor)) { verticesByFloor[floor].Remove(v); } } return(true); }
public bool ContainsVertex(Vertex v) { return(vertices.ContainsKey(v.getId())); }
public bool removeVertex(Vertex v) { foreach (Edge e in v.incidentEdges()) edges.Remove(e); //remove from <vertexId, vertex> structure vertices.Remove(v.getId()); //remove from <floorNum, List<Vertex> structure bool hasLocation = v.getLocation() != null && v.getLocation().getAbsoluteLocation() != null; if (hasLocation) { int floor = (int)v.getLocation().getAbsoluteLocation().getAltitude(); if (verticesByFloor.ContainsKey(floor)) { verticesByFloor[floor].Remove(v); } } return true; }
public bool ContainsVertex(Vertex v) { return vertices.ContainsKey(v.getId()); }
public bool addVertex(Vertex v) { if (vertices.ContainsKey(v.getId())) return false; //Add vertex to <vertexId, vertex> structure vertices.Add(v.getId(), v); //Add vertex to <floorNum, List<Vertex> structure if (v.getLocation() != null && v.getLocation().getAbsoluteLocation() != null) { int floor = (int)v.getLocation().getAbsoluteLocation().getAltitude(); if (!verticesByFloor.ContainsKey(floor)) { verticesByFloor.Add(floor, new List<Vertex>()); } verticesByFloor[floor].Add(v); } return true; }