From: Victor Porton <porton@narod.ru>
Subject: Re: Standard Set types don't support a feature
Date: Sun, 29 Oct 2017 19:35:49 +0200
Date: 2017-10-29T19:35:49+02:00 [thread overview]
Message-ID: <ot53hk$10bc$1@gioia.aioe.org> (raw)
In-Reply-To: ot5217$tp9$1@gioia.aioe.org
Dmitry A. Kazakov wrote:
> On 2017-10-29 17:15, Victor Porton wrote:
>> I want to represent a directed graph as a set of pairs (a,b) where a and
>> b are vertices.
>
> Any directed graph is a set of pairs.
I mean that I want to use a Set container not some other kind of containers
(not e.g. a matrix).
>> To efficiently find a transitive closure, I want to search for the first
>> element (a,x) of the graph with a given starting vertex a.
>>
>> It seems that standard containers do not support it (except of silly
>> broken use of keys).
>
> Graph is not a container, not in the sense an array or matrix is.
Graph contains a set of vertices and a set of edges. It may be said that
graph is two containers :-)
>> What would you suggest? Maybe should I use Bochs?
>
> Simple components have an implementation of directed graphs:
>
> http://www.dmitry-kazakov.de/ada/components.htm#directed_graphs
>
> [ Transitive closure requires no evaluation, a node = graph rooted in
> this node ]
If I first calculate transitive closure and store it in a matrix (or as I
consider, a sparse matrix represented as a set of pairs), then checking
existence of path between two given elements becomes much faster.
Well, maybe all it is a preliminary optimization. Maybe regular (non-sparse)
incidence matrix will be not slower.
--
Victor Porton - http://portonvictor.org
next prev parent reply other threads:[~2017-10-29 17:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-29 16:15 Standard Set types don't support a feature Victor Porton
2017-10-29 17:10 ` Dmitry A. Kazakov
2017-10-29 17:35 ` Victor Porton [this message]
2017-10-29 18:27 ` Dmitry A. Kazakov
2017-11-12 1:50 ` Robert Eachus
2017-11-17 0:28 ` Randy Brukardt
2017-10-29 17:28 ` Victor Porton
2017-10-29 17:35 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox