Opened 17 years ago
Closed 15 years ago
#68 closed task (done)
Port static graph implementation
Reported by: | Alpar Juttner | Owned by: | Peter Kovacs |
---|---|---|---|
Priority: | major | Milestone: | LEMON 1.2 release |
Component: | core | Version: | |
Keywords: | Cc: | ||
Revision id: |
Description
Namely the file
- lemon/static_graph.h
Attachments (12)
Change History (26)
comment:1 Changed 17 years ago by
Milestone: | LEMON 1.0 release → Post 1.0 |
---|
comment:2 Changed 16 years ago by
Owner: | changed from Alpar Juttner to Balazs Dezso |
---|
comment:3 Changed 16 years ago by
Milestone: | LEMON 1.1 release |
---|
comment:4 Changed 15 years ago by
Milestone: | → LEMON 1.2 release |
---|---|
Owner: | changed from Balazs Dezso to Peter Kovacs |
Status: | new → assigned |
Changed 15 years ago by
Attachment: | 68-1-cf360f758f25.patch added |
---|
Changed 15 years ago by
Attachment: | 68-2-f4b5c2d5449d.patch added |
---|
Changed 15 years ago by
Attachment: | 68-3-6cab2ab9d8e7.patch added |
---|
Changed 15 years ago by
Attachment: | 68-4-a3de05c56e7e.patch added |
---|
Changed 15 years ago by
Attachment: | 68-5-6959186d3612.patch added |
---|
Changed 15 years ago by
Attachment: | 68-6-2d82f9560e1a.patch added |
---|
Changed 15 years ago by
Attachment: | 68-7-4cad1981d18d.patch added |
---|
Changed 15 years ago by
Attachment: | 68-8-afad5d01ef8e.patch added |
---|
comment:5 follow-up: 7 Changed 15 years ago by
comment:6 Changed 15 years ago by
Could anyone tell me why it is important to sort the outgoing arcs of a node with respect to their target nodes during building a StaticDigraph
? It makes the build()
function about 15 percent slower, but is there any significant advantage? Could it make such algorithms faster that uses node maps and reads data for the target nodes of outgoing arcs?
comment:7 Changed 15 years ago by
Replying to kpeter:
- [afad5d01ef8e] Simplify
StaticDigraph::OutArcIt
implementation. It works with arc IDs instead of arcs and there are no function calls inoperator++()
. Using gcc with -O2 and -O3, it makes the iterator only 1-2 percent faster. Thus this modification is questionable.
I would like to withdraw this changeset, since the original interface is similar to the base iterator interface, thus it is better if someone would like to use StaticDigraph
with the "low-level syntax".
Consider to apply only the first seven changesets.
Changed 15 years ago by
Attachment: | 68-5-new-eff1caf6d32e.patch added |
---|
Changed 15 years ago by
Attachment: | 68-6-new-5764dd9b6e18.patch added |
---|
Changed 15 years ago by
Attachment: | 68-7-new-05b444bfc02b.patch added |
---|
comment:8 Changed 15 years ago by
I reworked the patches. The first three (namely [cf360f758f25], [f4b5c2d5449d], [6cab2ab9d8e7]) remained unchanged. The one that removes out-arc lists ([a3de05c56e7e]) turned out to be really questionable, since all adaptors use the base iterator interface (and some other core tools, as well). So I rebased the later changesets on the top of [6cab2ab9d8e7].
The new changesets:
- [eff1caf6d32e] Extend the interface of
StaticDigraph
(#68)
A rebased version of [6959186d3612]. - [5764dd9b6e18] Add a new build() function to
StaticDigraph
(#68)
It is similar to [2d82f9560e1a] with the exception that it uses a range of iterators as an input instad of an STL contanier. - [05b444bfc02b] Add tags to provide smaller iterator classes (#68, #252)
A rebased version of [4cad1981d18d] for merging with #252.
comment:9 Changed 15 years ago by
Other forms of the proposed build()
function could be imagined. E.g. we could introduce build(n,m,begin)
as an alternative to build(n,begin,end)
. (And the latter one could simply call the other one as build(n, std::distance(begin, end), begin)
).
Apart from that I would like to make sort()
in the old build()
function optional. What do you think about it? Which one should be the default option?
Changed 15 years ago by
Attachment: | 68-311-static-a143f19f465b.patch added |
---|
comment:10 follow-up: 11 Changed 15 years ago by
[a143f19f465b] makes some graph member functions static
. It modifies StaticDigraph
as well as other graph types.
comment:11 follow-up: 12 Changed 15 years ago by
Replying to kpeter:
[a143f19f465b] makes some graph member functions
static
. It modifiesStaticDigraph
as well as other graph types.
I can't see how these changes are related to #311.
comment:12 Changed 15 years ago by
Replying to alpar:
I can't see how these changes are related to #311.
It contains various Improvements for graphs and this ticket is clearly animprovement for graphs. :) In fact, the relation is historical. I wanted to attach this patch to #311 (when it was still open), but it seemed better to apply these changes to StaticDigraph
as well, thus I decided to attach it here.
I added a note to #311 about this patch, so the realtion is clear now. :)
comment:13 follow-up: 14 Changed 15 years ago by
All the relevant changesets went to the main branch.
Only one question left here:
I would like to make sort() in the old build() function optional. What do you think about it? Which one should be the default option?
comment:14 Changed 15 years ago by
Resolution: | → done |
---|---|
Status: | assigned → closed |
I attached 8 patches for
StaticDigraph
, some of which really needs revision.StaticDigraph
from SVN -r3524.StaticDigraph
. These improvements are the followings:node_num
to -1, to keepnodeNum()
correct for the empty structure, as well.DigraphExtender
to support the tests correctly.StaticDigraph
.StaticDigraph
to save one int value for each arc. The list was used only by the basic iteration interface, i.e. thenextOut(Arc&)
function, but it can be implemented easily and efficiently without the outgoing arc list, as well. This modification makes the basic interface (namelynextOut(Arc&)
) about 15 percent slower, but this interface is hardly used. However it reduces the number of stored integers from2n+4m
to2n+3m
, and it makes thebuild()
function slightly faster.StaticDigraph
withindex()
,arc()
andnode()
functions similarly to other static graph structures. They are especially needed together with the next changeset.build()
function toStaticDigraph
. This function builds the digraph from an arc list that contains pairs of integer indices from the range[0..n-1]
. It is useful in the cases when you would like to build aStaticDigraph
from scratch, i.e. you do not want to build another digraph that could be copied using the otherbuild()
function. Node and arc references are not important in this case, since the nodes and arcs can be indexed using the functions introduced in the former changeset. I think, this changeset greatly improves the usability ofStaticDigraph
.StaticDigraph::OutArcIt
implementation. It works with arc IDs instead of arcs and there are no function calls inoperator++()
. Using gcc with -O2 and -O3, it makes the iterator only 1-2 percent faster. Thus this modification is questionable.For benchmark results see #309.