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

[FEATURE REQUEST] Improve export/import functions #14

Closed
LdDl opened this issue Mar 6, 2021 · 0 comments · Fixed by #15
Closed

[FEATURE REQUEST] Improve export/import functions #14

LdDl opened this issue Mar 6, 2021 · 0 comments · Fixed by #15
Assignees
Labels
enhancement New feature or request

Comments

@LdDl
Copy link
Owner

LdDl commented Mar 6, 2021

Is your feature request related to a problem? Please describe.
Current implementation of Export function is: https://github.com/LdDl/ch/blob/master/export.go#L19
It creates single file with informations about edges and contractions, but no info about vertices' order position and importance.
Single CSV-file header:

// 		from_vertex_id - int64, ID of source vertex
// 		to_vertex_id - int64, ID of arget vertex
// 		f_internal - int64, Internal ID of source vertex
// 		t_internal - int64, Internal ID of target vertex
// 		weight - float64, Weight of an edge
// 		via_vertex_id - int64, ID of vertex through which the contraction exists (-1 if no contraction)
// 		v_internal - int64, Internal ID of vertex through which the contraction exists (-1 if no contraction)

So after calling Import function we must evaluate every vertex's order position and importance again: this is not cool and can take a long time if graph too big.
We need to export information about order position and importance to remove unnecessary calculations inside of Export function

Describe the solution you'd like and provide pseudocode examples if you can
Export function has to create 2 files: one is for edges, and second one is for vertices.
Edges file:

// 		from_vertex_id - int64, ID of source vertex
// 		to_vertex_id - int64, ID of arget vertex
// 		f_internal - int64, Internal ID of source vertex
// 		t_internal - int64, Internal ID of target vertex
// 		weight - float64, Weight of an edge
// 		via_vertex_id - int64, ID of vertex through which the contraction exists (-1 if no contraction)
// 		v_internal - int64, Internal ID of vertex through which the contraction exists (-1 if no contraction)

Vertices file:

// Header of main CSV-file containing information about vertices:
// 		vertex_id - int64, ID of vertex
// 		internal_id - int64, internal ID of arget vertex
// 		order_pos - int, Position of vertex in hierarchies (evaluted by library)
// 		importance - int, Importance of vertex in graph (evaluted by library)

Describe alternatives you've considered and provide pseudocode examples if you can
We can go even further and export third file: about contractions.
So finally we can get such structure:
Edges file (only real edges!):

// 		from_vertex_id - int64, ID of source vertex
// 		to_vertex_id - int64, ID of arget vertex
// 		f_internal - int64, Internal ID of source vertex
// 		t_internal - int64, Internal ID of target vertex
// 		weight - float64, Weight of an edge

Vertices file:

// Header of main CSV-file containing information about vertices:
// 		vertex_id - int64, ID of vertex
// 		internal_id - int64, internal ID of arget vertex
// 		order_pos - int, Position of vertex in hierarchies (evaluted by library)
// 		importance - int, Importance of vertex in graph (evaluted by library)

Contractions file:

// 		from_vertex_id - int64, ID of source vertex
// 		to_vertex_id - int64, ID of arget vertex
// 		f_internal - int64, Internal ID of source vertex
// 		t_internal - int64, Internal ID of target vertex
// 		weight - float64, Weight of an contraction
// 		via_vertex_id - int64, ID of vertex through which the contraction exists
// 		v_internal - int64, Internal ID of vertex through which the contraction exists

Additional context
After moditification of Export function we should make proper update for Import function also. So Import function has to accept 2 (or 3, depends on what we are going to do with contractions) arguments.

@LdDl LdDl added the enhancement New feature or request label Mar 6, 2021
@LdDl LdDl self-assigned this Mar 6, 2021
@LdDl LdDl linked a pull request Mar 6, 2021 that will close this issue
@LdDl LdDl closed this as completed in #15 Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants