g={(1 2 a)} is not isomorphic to G, since the weight of this edge in G is "c" not "a".
This is weird. Simply put, graphs G, G' (actually, any algebraic structures) are isomorphic if there exists some function f from {G<->G'} so that for any relation R(g1, g2) (g1, g2 in G), R'(f(g1), f(g2)) also holds for G' and vice versa. So any graph G' gained from G by renaming (permutation) of vertexes is isomorphic to G.
As it seems, you are instead interested in figuring out whether for any marked edge of g there exists edge connecting the same vertexes and bearing the same mark in G. Most simple way to do this is duplicating edges of G and sorting them by component. Then for each edge of query g it will take O(log(|G|)) to check whether G has the same edge (and it has the same mark). Thus, total time is O(|G|*log(|G|)) to prepare graph G and O(|g|*log(|G|)) to process each subsequent query.
Upd: By "sorting edges of G by component" I meant the following: build an array (or binary tree) of edges, sorted by first vertex then by second vertex. To search for an edge easily, it should be duplicated. For example, edge (1, 2, c) should be present as (1, 2, c) and (2, 1, c). So that, in array form, G from example above becomes
(1, 2, c)
(1, 3, d)
(1, 4, c)
(2, 1, c)
(2, 3, a)
(3, 1, d)
(3, 2, a)
(4, 1, c)
On the afterthought, it may be better to write both edges of G and g with vertex with lesser number first - this way, no duplication is needed.