Comments (4)
Hey @slabasan:
This is really a design question — we need both behaviors but the question is where they should happen
Since the nodes are the thing that ultimately goes in the DataFrame in the index, I think that id(self) == id(other)
(aka self is other
) should be the behavior we want there. Every DF should have nodes from only one graph, and in that scenario, comparing by node id makes sense. For trees that is effectively the same as comparing by callpath (only faster, since comparing ids is faster than comparing tuples). For graphs it’s not general enough -- you need to build the graph and compare nodes to determine which nodes are unique, since not every graph node has a unique callpath as in a CCT.
This last bit is key -- there shouldn’t be a callpath on the Node
in the final version of this, specifically because comparing the callpath isn’t general enough for graphs. We have to build the graph and use node identity (is
, or id(self) == id(other)
) for graphs. So, before you can compare graph nodes in hatchet, you should unify the graphs, and you should traverse and compare frame values to do that.
There are probably other situations (besides unification) where comparing frame values between nodes from separate graphs makes sense, but i would stick to always unify for now.
from hatchet.
Thanks @tgamblin for clarifying. So if we have a unify
in graphframe, let's say it returns two graphframes with updated graphs and dataframes. If we are trying to unify two graphframes (i.e., identical input data set), the unify should update the node ID's so they are consistent between both, correct? Then we should also save the mapping from the old nodes to the new nodes, which can be used to update the dataframe.
from hatchet.
@slabasan: I'd implement union
on Graph
first, and have it return two dicts:
def union(left, right):
"""Union two Graphs and return the resulting graph along with mappings
from the old graphs' nodes to the new graph's nodes.
Returns:
(Graph, dict, dict): unioned Graph and mappings from left and right ids (respectively)
to Graph's ids.
"""
then implement unify
on GraphFrame
and have it call union
and use the mappings to translate. I think this is basically what you're suggesting, right?
from hatchet.
I think this issue has been resolved. The node equivalence check is correct behavior, and we are working on implementing the union
operation on a graph.
from hatchet.
Related Issues (20)
- Graph Literal Validator
- Elide collapsed subtrees with triangle icons [Roundtrip] HOT 1
- Pan/Zoom on Trees [Roundrip] HOT 1
- Draw Trees to Utilize more Vertical Space [Roundtrip] HOT 2
- Collapse Trees by Default [Roundtrip]
- Add "inplace" to hatchet operations HOT 1
- Add bivariate color map to roundtrip HOT 1
- Make Roundtrip Javascript Loading More Dynamic / Change Javascript Development Workflow HOT 1
- Q: How to read in traces generated by Caliper? HOT 4
- Add a Reader for ROCProfiler HOT 2
- Hatchet multi-process problem when handling large graphs HOT 8
- build error for Python 3.9 HOT 1
- feature request: subtree aggregate, graphframe subtree HOT 4
- import multiprocess as mp HOT 8
- bug in cprofile reader
- Support for Perfetto Trace Format HOT 1
- Filter/squash error on HPCToolkit database: `AttributeError: 'int' object has no attribute '_hatchet_nid'` HOT 2
- build failure on python 3.11, longintrepr.h not found HOT 2
- Error Reading GProf Profiles HOT 3
- Sphinx Api docs section missing doc for submodules
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hatchet.