I am working my way through the example in the pgRouting manual (2.2). After running pgr_createTopology() and pgr_analyzeGraph():
pgr_test=# SELECT pgr_createTopology('edge_table',0.001);
NOTICE: PROCESSING:
NOTICE: pgr_createTopology('edge_table', 0.001, 'the_geom', 'id', 'source', 'target', rows_where := 'true', clean := f)
NOTICE: Performing checks, please wait .....
NOTICE: Creating Topology, Please wait...
NOTICE: -------------> TOPOLOGY CREATED FOR 18 edges
NOTICE: Rows with NULL geometry or NULL id: 0
NOTICE: Vertices table for table public.edge_table is:
public.edge_table_vertices_pgr
NOTICE: ----------------------------------------------
pgr_createtopology
--------------------
OK
(1 row)
pgr_test=# select pgr_analyzeGraph('edge_table', 0.001);
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edge_table',0.001,'the_geom','id','source','target','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
So there are 2 isolated segments, which turn out to have id = 17, 18:
pgr_test=# SELECT a.* FROM edge_table a, edge_table_vertices_pgr b, edge_table_vertices_pgr c WHERE a.source=b.id AND b.cnt=1 AND a.target=c.id AND c.cnt=1;
id | dir | source | target | cost | reverse_cost | x1 | y1 | x2 | y2 | the_geom
----+-----+--------+--------+------+--------------+-----+-----+----------------+-----+------------------------------------------------------------------------------------
17 | B | 14 | 15 | 1 | 1 | 0.5 | 3.5 | 1.999999999999 | 3.5 | 010200000002000000000000000000E03F0000000000000C4068EEFFFFFFFFFF3F0000000000000C40
18 | B | 16 | 17 | 1 | 1 | 3.5 | 2.3 | 3.5 | 4 | 0102000000020000000000000000000C4066666666666602400000000000000C400000000000001040
The id=18 case is due to crossing and can be fixed later by pgr_nodeNetwork(), but the id=17 case is due to touching and I thought it should be handled by createTopology(), and it persisted even after pgr_nodeNetwork(). I tried bigger tolerance values to no avail. The manual says tolerance is in projection unit, but I don't know whether this is relevant for the sample data in the manual?
I am using pgRouting-2.2.0 on Windows with Postgresql-9.5, PostGIS-2.2.