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

exporting edge weight from compressed html to pajek file #19

Open
drxilu opened this issue Oct 25, 2022 · 4 comments
Open

exporting edge weight from compressed html to pajek file #19

drxilu opened this issue Oct 25, 2022 · 4 comments

Comments

@drxilu
Copy link

drxilu commented Oct 25, 2022

Dear Anna,

Thanks for developing PastML and all updates, it is very useful to our current analysis.

I see from #16, you have updated a feature to parse compressed graphs to pajek files, and you also mentioned using different weights for nodes and branch sizes from #2.

I wonder if there is a way to export both nodes, edges, and edge weights (as the number 2 between the UK and the Netherlands in the blow graph ), from compressed graphs to pajek files, while the current feature generates nodes and edges:
image

Could you please let me know where in the script/variable these edge weights are stored, which I believe should be able to exact from some HTML outputs, unfortunately, I couldn't find them.

Thank you very much in advance.

Best, Xi

@annazhukova
Copy link
Contributor

Dear Xi,

I am sorry for an enormous delay with handling your request !

I have implemented the edge weight saving (starting with version 1.9.42), so the PAJEK arcs should now look like:
"<source_id> <target_id> ".

Note that there are three consequetive steps of tree compression in PastML:

  1. vertical compression (when connected parts of the tree with the same state get merged into metanodes),
  2. horizontal (when similar configurations get merged and metaedges are created, with the weight corresponding to the number of such configurations),
  3. trimming (when minor nodes are removed), which is controlled by --tip_size_threshold argument.

Previously, the compressed tree was saved to Pajek after the vertical compression step, so all the edges were of size 1.
I have now added an argument --pajek_timing, which allows to choose at which compression stage the tree should be saved to Pajek: by default 'VERTICAL', as before, but 'HORIZONTAL' and 'TRIM' are also possible. I guess in your case, you should use HORIZONTAL or even TRIM (which would correspond exactly to the HTML map that is produced)

Let me know if this works for you, please.

Best wishes,
Anna

@drxilu
Copy link
Author

drxilu commented Aug 7, 2023

Dear Anna,

Thank you so much for your reply and your efforts on modifications to the new version PastML!

I have installed the newer version 1.9.42 with python3.9.2:

Snapshot - 2023-07-8-14-53-08

However, it gives some errors related to UTF-8 code:

Snapshot - 2023-07-8-16-00-15

And if I use an older version 1.9.33:

Snapshot - 2023-07-8-14-33-23

Which works well as I previously did.

By any chance do you have an idea of what happened to the UTF-8 code issues?

Thank you again!

Best, Xi

@annazhukova
Copy link
Contributor

Hi Xi,

I am sorry that it produces errors. I am on maternity leave till January, and will not be able to look into this issue before that.

From the error description though, it seems like there might be an unusial character in your metadata file somewhere (around position 36294). So maybe a temporary fix could be to edit the metadata file.

I will look into this when I am back in January.
Sorry for such a long delay.

Cheers,
Anna

@drxilu
Copy link
Author

drxilu commented Aug 7, 2023

Hi Anna,

Thanks for your quick reply, and look into this!

I was using the same metadata inputs in older and newer versions; not sure if that also causes the different outputs, but I will check the metadata and specific position.

Please do not worry about that; also, congratulations, I hope you have a nice break and time with your family!

Once again, thank you!

Best, Xi

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

2 participants