pub struct Graph {
pub vertices: HashMap<Uuid, VertexData>,
pub edges: HashMap<Uuid, EdgeData>,
pub adj_out: HashMap<Uuid, HashSet<Uuid>>,
pub adj_in: HashMap<Uuid, HashSet<Uuid>>,
pub vertex_labels: HashMap<String, HashSet<Uuid>>,
pub edge_labels: HashMap<String, HashSet<Uuid>>,
}
Expand description
グラフ(列指向表現)
Fields§
§vertices: HashMap<Uuid, VertexData>
頂点データ(ID→データ)
edges: HashMap<Uuid, EdgeData>
エッジデータ(ID→データ)
adj_out: HashMap<Uuid, HashSet<Uuid>>
外向き隣接リスト(src→[dst])
adj_in: HashMap<Uuid, HashSet<Uuid>>
内向き隣接リスト(dst→[src])
vertex_labels: HashMap<String, HashSet<Uuid>>
ラベル別頂点インデックス(ラベル→[頂点ID])
edge_labels: HashMap<String, HashSet<Uuid>>
ラベル別エッジインデックス(ラベル→[エッジID])
Implementations§
Source§impl Graph
impl Graph
Sourcepub fn add_vertex(&mut self, vertex: VertexData) -> Uuid
pub fn add_vertex(&mut self, vertex: VertexData) -> Uuid
頂点を追加
Sourcepub fn get_vertex(&self, id: &Uuid) -> Option<&VertexData>
pub fn get_vertex(&self, id: &Uuid) -> Option<&VertexData>
頂点を取得
Sourcepub fn remove_vertex(&mut self, id: &Uuid) -> bool
pub fn remove_vertex(&mut self, id: &Uuid) -> bool
頂点を削除
Sourcepub fn remove_edge(&mut self, id: &Uuid) -> bool
pub fn remove_edge(&mut self, id: &Uuid) -> bool
エッジを削除
Sourcepub fn vertices_by_label(&self, label: &String) -> HashSet<Uuid>
pub fn vertices_by_label(&self, label: &String) -> HashSet<Uuid>
ラベル別頂点を取得
Sourcepub fn edges_by_label(&self, label: &String) -> HashSet<Uuid>
pub fn edges_by_label(&self, label: &String) -> HashSet<Uuid>
ラベル別エッジを取得
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
頂点数を取得
Sourcepub fn edge_count(&self) -> usize
pub fn edge_count(&self) -> usize
エッジ数を取得
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnwindSafe for Graph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more