Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/s1ck/assert-graph-iso
Checks if two property graphs are isomorphic.
https://github.com/s1ck/assert-graph-iso
gdl graph isomorphism property-graph
Last synced: 4 days ago
JSON representation
Checks if two property graphs are isomorphic.
- Host: GitHub
- URL: https://github.com/s1ck/assert-graph-iso
- Owner: s1ck
- License: mit
- Created: 2021-03-23T20:54:34.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-04-03T15:35:51.000Z (over 3 years ago)
- Last Synced: 2024-12-18T01:12:54.467Z (5 days ago)
- Topics: gdl, graph, isomorphism, property-graph
- Language: Rust
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### assert-graph-iso
A test utility to check if two property graphs are equal, i.e., isomorphic.
The check is performed by computing a canonical string representation for each graph.
If the canonical representations are identical, the graphs are considered isomorphic.
The crate is supposed to be used as a test utility, it is not designed for large scale graph comparisons.#### Property graph data model
A property graph consists of nodes and relationships.
Nodes have zero or more labels, relationships have zero or one relationship type.
Both, nodes and relationships have properties, organized as key-value-pairs.
Relationships are directed, starting at a source node and pointing at a target node.#### Usage
The crate contains a `Graph` trait which defines a property graph.
Users are supposed to implement the trait for their custom graph implemention.
The crate also provides a `gdl` feature which allows for simple graph definition using a declarative language.
Check out the [gdl on crates.io](https://crates.io/crates/gdl) for more information about the language.Testing for equality:
```rust
use ::gdl::Graph as GdlGraph;
use assert_graph_iso::*;let g1 = "(a), (b), (a)-[:REL { foo:42 }]->(b)".parse::().unwrap();
let g2 = "(a), (b), (b)-[:REL { foo:42 }]->(a)".parse::().unwrap();assert!(equals(&g1, &g2))
```Compare the canonical representations for easier debugging:
```rust
use ::gdl::Graph as GdlGraph;
use assert_graph_iso::*;let g1 = "(a:Label1), (b:Label2), (a)-->(b)".parse::().unwrap();
let g2 = "(a:Label2), (b:Label1), (b)-->(a)".parse::().unwrap();assert_eq!(canonicalize(&g1), canonicalize(&g2))
```### License
Apache 2.0 or MIT