I would approach this as two separate problems. First, the individual line segments must be dissolved into connected components; just dissolving all of them on a default value won't work. This is a graph theory problem, and what we want are the "connected component sub graphs".
I'm sure there's a way to hack this with network analyst, but my preference would be to treat it like the graph problem it is; don't reinvent the wheel, just install the excellent Networkx python module and try the following:
from networkx import Graph, connected_components
G = Graph()
# iterate through your feature class and build a graph
for row in featureclass:
# we need a unique representation for each edges start and end points
start = row.shape.getpart()[0]
end = row.shape.getpart()[-1]
edge = frozenset((start,end))
G.add_edge(edgestart,end,oid=row.oid)
# get the connected components
Components = connected_components(G)
# we now have a "list of lists" containing edges grouped by their component
# there's several ways to apply this to the feature class...eg
for i, connected in enumerate(Components):
# assign id = i to the group by writing it to a field for all members
# of that component (the row oid is an attribute of the edge)
Second step would be the dissolve and select by location as suggested by dmahr
I've used a similar technique many times successfully. Graph theory is awesome and solves many GIS problems, and Networkx is a great tool to implement this in python.