Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to remove singleton from edges #29

Closed
maximelucas opened this issue Dec 16, 2021 · 2 comments
Closed

Add function to remove singleton from edges #29

maximelucas opened this issue Dec 16, 2021 · 2 comments

Comments

@maximelucas
Copy link
Collaborator

Currently, edges contain singletons (nodes) :

list(H._edge.values())
# [[0], [3, 4], [4], [4]]

it's often useful to have a list of edges that does not contain nodes.
Add a function to get that.
Should the function output a new external list, of remove singletons from the edges stored internally in the HyperGraph?

@leotrs
Copy link
Collaborator

leotrs commented Dec 16, 2021

My suggestion is to implement the following:

H.edges(order=1)
# -> EdgeView([[0], [3], ...])
H.singleton_edges()
# -> same as above
H.remove_singletons()
# -> modifies H and returns None

Similarly, we should do something similar for removing all connected components other than the largest one:

H.connected_components()
# -> list of EdgeView objects
H.connected_components(k)
# -> list of EdgeView objects containing only the k largest components
H.largest_component()
# -> same as H.connected_components(1)
H.remove_components(k=1)
# -> modifies H by removing all but the k (default k=1) largest components and returns None

@nwlandry
Copy link
Collaborator

Fixed with #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants