Last active
February 12, 2024 18:36
Revisions
-
colllin revised this gist
Feb 12, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ - serialization/deserialization symmetry - in general need more formatting options OR go to/from a major interchange format and recommend a separate library for every other kind of format in/out. - But need to support at least one text-based in/out so that we can easily print to inspect a graph - Why does `rx.node_link_json` require `str` values in the node and edge payloads, when JSON supports several other data types? This makes deserialization awkward and error-prone, so for now I'm just converting the nodes to `{'json': json.dumps(node_payload)}`. - no `node_index_map()`? So you have this clunky interface where you can get either the indices or the data but not both - `subgraph()` resets node indices 😱🤯 - `add_nodes_from()` should just be called `add_nodes()`, same for `add_edges_from()` -
colllin revised this gist
Feb 6, 2024 . 1 changed file with 1 addition and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,21 +8,9 @@ - `rx.union()` should accept a merge predicate function to determine which nodes to merge, and/or the attrs of the merged node - `PyGraph.contract_nodes()` equivalent to `merge_nodes()` in DiGraph and DAG? (Should be same name...) - `rx.is_subgraph_isomorphic(graph1, graph2)` returns `True` when `graph1` is empty (has `0` nodes) and `graph2` is not empty (has >0 nodes), but I believe it should return False, since an empty graph shouldn't have any subgraphs that are isomorphic with graph2... right? - workaround? instead of `rx.is_subgraph_isomorphic`, use `next(rx.vf2_mapping(..., subgraph=True), None) is not None` ``` def is_subgraph_isomorphic(*args, **kwargs): return next(vf2_mapping(*args, subgraph=True, **kwargs), None) is not None ``` -
colllin revised this gist
Feb 6, 2024 . 1 changed file with 19 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,5 +8,23 @@ - `rx.union()` should accept a merge predicate function to determine which nodes to merge, and/or the attrs of the merged node - `PyGraph.contract_nodes()` equivalent to `merge_nodes()` in DiGraph and DAG? (Should be same name...) - `rx.is_subgraph_isomorphic(graph1, graph2)` returns `True` when `graph1` is empty (has `0` nodes) and `graph2` is not empty (has >0 nodes), but I believe it should return False, since an empty graph shouldn't have any subgraphs that are isomorphic with graph2... right? - Also rx.vf2_mapping will return empty mappings (`{}`) in this situation. - workaround? instead of use `next(rx.vf2_mapping(..., subgraph=True), None) is not None` ``` # First wrap vf2 mapping to remove empty mappings. def vf2_mapping(*args, **kwargs): for mapping in rx.vf2_mapping(*args, **kwargs): # This skips "empty" mappings, i.e. `{}`, which happens when one of the graphs is empty. if mapping: yield mapping # Then rewrite is_subgraph_isomorphic to check for any non-empty mappings. # This solves two problems: # - one where is_subgraph_isomorphic returns True but vf2_mapping returns an empty list # - ther other where vf2_mapping returns empty mappings def is_subgraph_isomorphic(*args, **kwargs): return next(vf2_mapping(*args, subgraph=True, **kwargs), None) is not None ``` - -
colllin revised this gist
Feb 6, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,4 +8,5 @@ - `rx.union()` should accept a merge predicate function to determine which nodes to merge, and/or the attrs of the merged node - `PyGraph.contract_nodes()` equivalent to `merge_nodes()` in DiGraph and DAG? (Should be same name...) - `rx.is_subgraph_isomorphic(graph1, graph2)` returns `True` when `graph1` is empty (has `0` nodes) and `graph2` is not empty (has >0 nodes), but I believe it should return False, since an empty graph shouldn't have any subgraphs that are isomorphic with graph2... right? - workaround? instead use `next(rx.vf2_mapping(..., subgraph=True), None) is not None` - -
colllin renamed this gist
Feb 6, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,4 +7,5 @@ - `compose()` accepts an edge map which prevents having multiple edges from one node in the main graph to multiple nodes in the added fragment. Instead, it should accept an edge list in the same format used by `add_edges_from()` - `rx.union()` should accept a merge predicate function to determine which nodes to merge, and/or the attrs of the merged node - `PyGraph.contract_nodes()` equivalent to `merge_nodes()` in DiGraph and DAG? (Should be same name...) - `rx.is_subgraph_isomorphic(graph1, graph2)` returns `True` when `graph1` is empty (has `0` nodes) and `graph2` is not empty (has >0 nodes), but I believe it should return False, since an empty graph shouldn't have any subgraphs that are isomorphic with graph2... right? - -
colllin revised this gist
Jan 5, 2024 . No changes.There are no files selected for viewing
-
colllin revised this gist
Jan 5, 2024 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,4 +6,5 @@ - `add_nodes_from()` should just be called `add_nodes()`, same for `add_edges_from()` - `compose()` accepts an edge map which prevents having multiple edges from one node in the main graph to multiple nodes in the added fragment. Instead, it should accept an edge list in the same format used by `add_edges_from()` - `rx.union()` should accept a merge predicate function to determine which nodes to merge, and/or the attrs of the merged node - `PyGraph.contract_nodes()` equivalent to `merge_nodes()` in DiGraph and DAG? (Should be same name...) - -
colllin revised this gist
Jan 4, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,7 @@ - in general need more formatting options OR go to/from a major interchange format and recommend a separate library for every other kind of format in/out. - But need to support at least one text-based in/out so that we can easily print to inspect a graph - no `node_index_map()`? So you have this clunky interface where you can get either the indices or the data but not both - `subgraph()` resets node indices 😱🤯 - `add_nodes_from()` should just be called `add_nodes()`, same for `add_edges_from()` - `compose()` accepts an edge map which prevents having multiple edges from one node in the main graph to multiple nodes in the added fragment. Instead, it should accept an edge list in the same format used by `add_edges_from()` - `rx.union()` should accept a merge predicate function to determine which nodes to merge, and/or the attrs of the merged node -
colllin renamed this gist
Jan 4, 2024 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
colllin revised this gist
Jan 4, 2024 . 1 changed file with 8 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,9 @@ - serialization/deserialization symmetry - in general need more formatting options OR go to/from a major interchange format and recommend a separate library for every other kind of format in/out. - But need to support at least one text-based in/out so that we can easily print to inspect a graph - no `node_index_map()`? So you have this clunky interface where you can get either the indices or the data but not both - `subgraph()` resets node indices - `add_nodes_from()` should just be called `add_nodes()`, same for `add_edges_from()` - `compose()` accepts an edge map which prevents having multiple edges from one node in the main graph to multiple nodes in the added fragment. Instead, it should accept an edge list in the same format used by `add_edges_from()` - `rx.union()` should accept a merge predicate function to determine which nodes to merge, and/or the attrs of the merged node - -
colllin created this gist
Jan 4, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ - serialization/deserialization - no node_index_map? - subgraph resets node indices - "add_nodes_from" should just be "add_nodes", same for add_edges_from - compose accepts an edge map which prevents having multiple edges from one node in the main graph to multiple nodes in the added fragment. - union should accept a merge predicate function to determine which nodes to merge, and/or the attrs of the merged node -