From: Victor Porton <porton@narod.ru>
Subject: Re: Simple Components (Generic_Directed_Graph)
Date: Mon, 30 Oct 2017 20:30:57 +0200
Date: 2017-10-30T20:30:57+02:00 [thread overview]
Message-ID: <ot7r4v$1caq$1@gioia.aioe.org> (raw)
In-Reply-To: ot722v$1sj0$1@gioia.aioe.org
Dmitry A. Kazakov wrote:
> On 2017-10-30 11:41, Victor Porton wrote:
>
>> I do not understand your logic in Generic_Directed_Graph:
>>
>> The procedures like
>>
>> procedure Disconnect (Parent : Node; Child : Node);
>>
>> do not take "Graph" argument.
>
> A graph consists of connected nodes. Each node is in and a graph.
>
>> Does it mean that there exists just one graph (per instantiation)?
>
> No. If two nodes are mutually unreachable you have two graphs.
>
>> This looks wrong for me. First it is using global variables.
>
> It uses referential semantics. Node is an access type to the type you
> pass to the package when you instantiate it. E.g. if you want a graph of
> Strings you instantiate the package with String. Then Node is a pointer
> to string.
>
> The notion of scope does not really applied to the structures like
> graph. You can scope the pool you pass to the instance. You can scope
> nodes with some logic attached when a node leaves its scope. But
> otherwise it makes little sense to talk about the scope of a graph.
Oh, I've finally realized that Node_Type and Node are not the same type. Now
your logic seems clear.
But how to solve my particular problem?
I have two objects (URI1 and URI2) of URI_Type type each (or for simplicity
both could be two strings). I need to check if there exists a path from URI1
to URI2. How to do this?
My current idea is to use Ada standard "map" container which could map from
"access URI_Type" to "URI_Type" (for all URIs in the considered finite set)
before asking your generic package for existence of a path.
The same problem appears when I insert new edges: An edge should be
identified by two values of type URI_Type but you require two accesses to
URI_Type instead. Should I convert URI_Type to "access URI_Type" using a
standard map before inserting into the graph?
--
Victor Porton - http://portonvictor.org
next prev parent reply other threads:[~2017-10-30 18:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-30 10:41 Simple Components (Generic_Directed_Graph) Victor Porton
2017-10-30 11:04 ` Victor Porton
2017-10-30 11:34 ` Dmitry A. Kazakov
2017-10-30 11:23 ` Dmitry A. Kazakov
2017-10-30 14:58 ` Victor Porton
2017-10-30 15:46 ` Dmitry A. Kazakov
2017-10-30 17:46 ` Dennis Lee Bieber
2017-10-30 20:29 ` Dmitry A. Kazakov
2017-10-30 15:13 ` Victor Porton
2017-10-30 15:54 ` Dmitry A. Kazakov
2017-10-30 18:30 ` Victor Porton [this message]
2017-10-30 20:43 ` Dmitry A. Kazakov
2017-10-30 21:20 ` Victor Porton
2017-10-30 22:39 ` Dmitry A. Kazakov
2017-10-31 7:36 ` Simon Wright
2017-10-31 8:16 ` Dmitry A. Kazakov
2017-10-31 11:12 ` Victor Porton
2017-10-31 12:42 ` Dmitry A. Kazakov
2017-10-31 15:07 ` Victor Porton
2017-10-31 15:48 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox