[Networkit] Bug: Showing two Profiles in the same Notebook

Patrick Bisenius patrick.bisenius at gmail.com
Thu Nov 19 22:03:11 CET 2015


Hi,

my initial diagnosis came after digging for about 10 minutes in the rendered document with the Chrome dev tools. It has nothing to do with data-image attributes.

Currently, an instance of the Profile class keeps a private variable __pageCount which is incremented every time .show() is called [1]. This works fine if the same Profile instance is output multiple times but fails if two different profiles are rendered. The __pageCount variable is used for the ID of the HTML container element [2, 3, 4].

In summary, rendering the same profile twice results in NetworKit_Page_0 and NetworKit_Page_1, but rendering two different profiles results in two containers with the same ID NetworKit_Page_0. Since element IDs must be unique, document.getElementById() always returns the first element in the document. Thus, the graphs of the second profile are never rendered.

Proposed solution: The easiest way is to generate and store a random value when a new Profile is created. This random value should then be used in conjunction with Profile.__pageCount to create a unique ID for each rendered profile.

[1] https://algohub.iti.kit.edu/parco/NetworKit/NetworKit/files/ccd3995b23a6256915c9773f9fac72ad80d1303a/networkit/profiling/profiling.py#L442 <https://algohub.iti.kit.edu/parco/NetworKit/NetworKit/files/ccd3995b23a6256915c9773f9fac72ad80d1303a/networkit/profiling/profiling.py#L442>
[2] https://algohub.iti.kit.edu/parco/NetworKit/NetworKit/files/ccd3995b23a6256915c9773f9fac72ad80d1303a/networkit/profiling/profiling.py#L437 <https://algohub.iti.kit.edu/parco/NetworKit/NetworKit/files/ccd3995b23a6256915c9773f9fac72ad80d1303a/networkit/profiling/profiling.py#L437>
[3] https://algohub.iti.kit.edu/parco/NetworKit/NetworKit/files/ccd3995b23a6256915c9773f9fac72ad80d1303a/networkit/profiling/html/profile.html#L1 <https://algohub.iti.kit.edu/parco/NetworKit/NetworKit/files/ccd3995b23a6256915c9773f9fac72ad80d1303a/networkit/profiling/html/profile.html#L1>
[4] https://algohub.iti.kit.edu/parco/NetworKit/NetworKit/files/ccd3995b23a6256915c9773f9fac72ad80d1303a/networkit/profiling/html/profile.html#L34 <https://algohub.iti.kit.edu/parco/NetworKit/NetworKit/files/ccd3995b23a6256915c9773f9fac72ad80d1303a/networkit/profiling/html/profile.html#L34>

> Am 19.11.2015 um 21:16 schrieb Christian Staudt <christian.staudt at kit.edu>:
> 
> Thanks, if you feel you have an idea on the problem, your feedback would be appreciated.
> Chris
> 
> On 19 Nov 2015, at 01:28, Patrick Bisenius <patrick.bisenius at gmail.com> wrote:

Greetings,
Patrick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20151119/4cec3f4d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20151119/4cec3f4d/attachment-0001.sig>


More information about the NetworKit mailing list