Feedback networks

From InterSciWiki

Jump to: navigation, search

Subject: feedback.py - code for directed graphs From: "Natasa Kejzar" <natasa.kejzar@fdv.uni-lj.si> Date: Thu, April 2, 2009 2:31 am To: drwhite@uci.edu Options: View Full Header | View Printable Version | Download this as a file | View Message details

Dear Doug,

In the attachment I'm sending you the code I used for directed version of the feedback model for my dissertation.

If you remember (or have a copy of it) - I did implement 2 possibilities:

(a) initial node for traversing was selected according to its full degree (b) initial node for traversing was selected according to its OUTDEGREE

(see the additional parameter in the function def sample_starting_node(a,G,outdegree) in the attached code file)

Then I always considered only outdirected links (for next steps of traversal).

If you would want to change that (according to the last email about traversing semipaths), I tried to comment the additions that you would have to do to the code with "###" (three hashes). The only change would be in the function

traversal(G,s,distance,g,source)

See if that would be applicable to your needs.

If you want to save also the traversal frequency for links, this would need some more lines of code in the function "traversal". You would have to save the path along the way and add weights to links that were traversed in the case when the traversal was successful, otherwise not.

Best, Natasa