//	4/22/96	Doesn't handle a map that contains an empty image.
//		Should fix that.

Boolean Homeo::mapIsContinuous() const
{
				// Check for continuity at vertices

//cout << "Is map continuous?  " ;
//cout << (*this) << endl;

	SetBrowser<Vertex> iv(theGraph);

	for(iv.init();iv.ok();iv.advance())
	{
//cout << iv.current() << endl;
		CircListBrowser<DE> ie(iv.current());
		ie.init();
		if(ie.ok())
		{
			Set<DE> S;
			CircListBrowser<DE> i(theGraph.originOf(theMap.derivative(ie.ahead())));
			for(i.init();i.ok();++i) S.add(i.ahead());
			for(++ie;ie.ok();++ie)
			{	
				if( !S.has( theMap.derivative(ie.ahead()) ) )
				{
cout << endl << "The map is not continuous at vertex " << iv.current() << endl;
cout << ie.ahead() << " -> " << theMap.derivative(ie.ahead()) << "..., while ";
ie.init();
cout << ie.ahead() << " -> " << theMap.derivative(ie.ahead()) << "..." << endl;
					return 0;
				}
			}
		}
	}
//cout << " OK at vertices, " ;
				// Check images for continuity

	SetBrowser<MapElement> iii(theMap);
	for(iii.init();iii.ok();iii.advance())
	{
		LinListBrowser<DE> j(iii.current().image());
		j.init();
		if( j.ok() )
		{
			++j;
			for(; j.ok() ; ++j )
			{
				if(!theGraph.originOf(j.behind().bar()).
					isOriginOf(j.ahead()) )
				{
cout << endl << "The image of " << iii.current().source() << " is not continuous at " <<
		j.behind() << " " << j.ahead() << endl;
					return 0;
				}
			}
		}
	}
//cout << "OK in image interiors: Map is continuous" << endl;

	return 1;
}
