Comments (10)
Okay, this makes sense and I completely agree. Perhaps we can tackle this at the same time as the DegreeView? I'll create a branch called "views" to work on this issue.
from xgi.
There's another possibility: what if the user wants a dictionary of ids and members?
H.edges_members()
# SomeKindOfView({3: [0], 2: [3, 4], ...})
from xgi.
Agreed, that can be useful sometimes. That's what H._edge
currently outputs.
Could make it into a view too.
I still feel like have some simple function, in addition, that outputs just the list of list of nodes is often convenient?
from xgi.
I still feel like have some simple function, in addition, that outputs just the list of list of nodes is often convenient?
Agreed! If we implement what I suggest here, the following would just return a list of lists:
H.edges().values()
from xgi.
I might have a preference for a default view that looks like the one of networkx for consistency:
EdgeView([(1, 2), (2, 3)])
I obviously see the point of all the other solutions with IDs and the dict ids values, so I would totally implement those as well, but it would be nice for the default one (again, imho) to be as close as possible to the networkx one.
from xgi.
I tend to agree. @nwlandry ?
from xgi.
Hmmmm. I hadn't thought about the EdgeView simply being an edgelist. Currently in convert.py
, there is a to_hyperedge_list()
and to_hyperedge_dict()
function. These functions return lists and dicts respectively, not views, so it would be interesting to consider doing this.
The reason that I have both edge IDs and node IDs is so that nodes can quickly query the edges of which they are a part. How would you modify the EdgeView? Would it simply be that the underlying data would be a list of lists, not a dictionary of lists?
from xgi.
The reason that I have both edge IDs and node IDs is so that nodes can quickly query the edges of which they are a part.
This is super useful, I agree. As I said, but that's just my very biased opinion :P, ideally, I'd like the default version to be comparable to networkx's. Then maybe an option there could return the entire dict?
from xgi.
Sure, I also totally understand the usefulness of having a view that returns edge IDs. That's why I suggested to have two Views in my original message: (i) one that returns the edge IDs (as currently), and (ii) one that returns the edges as a list of list of node IDs.
When typing H.edges
I feel like a user would expect to see (ii), and it would also be consistent with NetworkX. I would name it EdgeView for consistency.
That's why I just suggested in my original message to rename (i), currently called EdgeView and accessed with H.edges
, to EdgeIDView, and access it with, say, H.edges_id
.
(Returning a dict {edge_id : list_of_nodes} can be useful too, but we can already use your function to_hyperedge_dict()
and it feels less urgent to me to a have simple function for it).
What do you think?
from xgi.
I believe we still don't have a way to do this. So I propose the following:
H.edges
# -> EdgeView(...)
H.edges.members(edge_id)
# -> [members of the specified edge]
H.edges.members()
# -> [[members of edge 0], [members of edge 1], ...]
H.edges.members(dtype=dict)
# -> {0: [members of edge 0], 1: [members of edge 1], ...}
The first two already work. The third one is easy to implement.
from xgi.
Related Issues (20)
- Warning when specifying node colors HOT 2
- change size of node labels? HOT 1
- Add NBQA
- Flagged lattices? HOT 3
- Add tensor functionality to eignevector centralities
- incorporate Network Geometry with Flavours
- incorporate pseudofractal generative models
- Allow `draw_nodes` to accept an iterable as the first argument.
- Should draw with convex hull be the default and only behavior? HOT 6
- Returning node positions from `xgi.draw` HOT 3
- how to calculate the average path length? HOT 9
- Add more statistics functionality HOT 1
- Fix warning in `draw_multilayer`
- katz centrality should return the same data type as the other centrality measures
- Add recipe for returning all IDs corresponding to the maximum.
- `rescale_sizes` doesn't work for numerical inputs HOT 3
- Other Resources should contain EasyGraph HOT 2
- weighted projection of hypergraphs HOT 3
- Add a way to specify `vmin` and `vmax` HOT 2
- add back edgecolor argument to draw hulls with white face but colored contour HOT 3
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 xgi.