Magnetism as a mass term of the edge states in graphene