资 源 简 介
地图着色把地图上的每个城市抽象为一个点,并给每个城市编号,,相邻的城市之间用直线连接。据此做出邻接矩阵,若第i个城市与第j个城市相邻,则metro[i][j]=1,否则metro[i][j]=0。
算法:按照编号从小到大的顺序检查每个城市,对每个城市从1到4使用4种颜色着色,若当前颜色可用(即不与相邻城市颜色相同),则着色;否则测试下一种颜色。
-Map coloring to each city on the map as a point of abstraction, and to every city number, adjacent lines to connect between cities. Accordingly to make adjacency matrix, if the section i and section j cities adjacent cities, the metro [i] [j] = 1, otherwise the metro [i] [j] = 0. Algorithm: In accordance with the code sequence from small to large checks every city, every city on 1-4 from the use of four kinds of color shading, color can be used if the current (ie not with the same colors as the neighboring cities), then coloring Otherwise, the next test colors.